﻿@using MVC_Demo.Models;
@using WebApplication1.Models.Database;
@{
	var categorys = ViewData["category"] as List<Category>;
	var goods = ViewData["goods"] as List<Good>;
	var cid = (int)ViewData["cid"];
}
<style>
	.cur {
		background-color: #69c8ff;
	}
</style>
<div class="container">
	<!-- InstanceBeginEditable name="MainBody" -->
	<link rel="stylesheet" type="text/css" href="~/css/household.css" />
	<link rel="stylesheet" type="text/css" href="~/css/goods-item.css" />
	<div class="phone-market">
		<div class="banner">
			<div class="xgs-row">
				<img src="~/img/household/banner.png" width="100%" height="300">
			</div>
		</div>
	</div>
	<!--  -->
	<div class="household-container  goods-item">
		<div class="xgs-row" style="padding: 0;background-color: white;">
			<ul class="household-navtab" style="display: inline-block;">
				<li><a @{string a= cid==0?"class=cur":"";}@a href="./market.html">全部</a></li>

				@{
					foreach (var item in categorys)
					{
						<li><a @{string b= cid==item.Id?"class=cur":"";}@b  href="./market.html?cid=@item.Id">@item.CateName</a></li>
					}
				}


				@*<li><a style="background-color: #69c0ff;color: white;" href="javascript:void(0);">文学</a></li>
				<li><a href="javascript:void(0);">社科</a></li>
				<li><a href="javascript:void(0);">经管</a></li>
				<li><a href="javascript:void(0);">少儿</a></li>
				<li><a href="javascript:void(0);">文教</a></li>
				<li><a href="javascript:void(0);">科技</a></li>
				<li><a href="javascript:void(0);">艺术</a></li>*@
			</ul>
		</div>

		<div class="tab-item white-panel" style="padding: 20px 0;margin-top: 20px;">
			<!-- 文学 -->
			<div id="wenxue" class="wenxue">
				@{
					int row;
					//商品总数
					//行数：如果总数除于4能除尽	=商品总数/4
					//除得尽的情况
					if (goods.Count % 4 == 0)
					{
						row = goods.Count / 4;
					}
					else
					{
						row = goods.Count / 4 + 1;
					}

					for (var i = 1; i <= row; i++)
					{
						<div class="xgs-row">
							@{
								var list = goods.Skip((i - 1) * 4).Take(4).ToList();
								foreach (var item in list)
								{
									<div class="xgs-col4">
										<a href="detail.html?id=@item.Id">
											<div>
												<img src="@item.Cover" alt="">
												<span class="goods-title">@item.Name</span>
												<p class="price">￥@item.Price</p>
											</div>
										</a>
									</div>
								}
							}
						</div>
					}
				}

				@*
				<div class="xgs-col4">
				<a href="detail">
				<div>
				<img src="~/img/phone-market/redmi9a.jpg" alt="">
				<span class="goods-title">
				海尔（Haier）前置过滤器40微米免拆反冲洗家用大通量管道自来水全屋净化净水器中央净水机PF2A 6分接口
				反冲洗
				</span>
				<p class="price">￥379.00</p>
				</div>
				</a>
				</div>
				<div class="xgs-col4">
				<a href="detail">
				<div>
				<img src="~/img/phone-market/redmi-note9pro.jpg" alt="">
				<span class="goods-title">
				Redmi Note 9 Pro 5G 一亿像素 骁龙750G 33W快充 120Hz刷新率 湖光秋色
				8GB+128GB
				智能手机
				小米 红米
				</span>
				<p class="price">￥1299.00</p>
				</div>
				</a>
				</div>
				<div class="xgs-col4">
				<a href="detail">
				<div>
				<img src="~/img/phone-market/redmik40.jpg" alt="">
				<span class="goods-title">
				Redmi K40 骁龙870 三星AMOLED 120Hz高刷直屏 4800万高清三摄
				12GB+256GB 幻境
				游戏电竞5G手机 小米 红米
				</span>
				<p class="price">￥2299.00</p>
				</div>
				</a>
				</div>
				<div class="xgs-col4">
				<a href="detail">
				<div>
				<img src="~/img/phone-market/redmi-note10pro.jpg" alt="">
				<span class="goods-title">
				Redmi Note 10 Pro 5G 天玑1100旗舰芯 67W快充 120Hz旗舰变速金刚屏 星纱
				6GB+128GB
				智能手机 小米红米
				</span>
				<p class="price">￥1499.00</p>
				</div>
				</a>
				</div>
				</div>

				<!-- 文学 -->
				<div class="xgs-row">
				<div class="xgs-col4">
				<a href="detail">
				<div>
				<img src="~/img/phone-market/xiaomi11.jpg" alt="">
				<span class="goods-title">小米11青春版 骁龙780G处理器AMOLED柔性直屏5G手机 清甜荔枝 8GB+128GB</span>
				<p class="price">￥1999.00</p>
				</div>
				</a>
				</div>
				<div class="xgs-col4">
				<a href="detail">
				<div>
				<img src="~/img/phone-market/xiaomimix4.jpg" alt="">
				<span class="goods-title">
				小米 MIX4 骁龙888+ 一体化陶瓷机身 全面屏 一亿像素三摄 哈曼卡顿双扬声器 8GB+128GB
				陶瓷黑
				5G旗舰手机
				</span>
				<p class="price">￥5799.00</p>
				</div>
				</a>
				</div>
				<div class="xgs-col4">
				<a href="detail">
				<div>
				<img src="~/img/phone-market/xiaomi11-ultra.jpg" alt="">
				<span class="goods-title">
				小米11 Ultra 至尊 5G 骁龙888 2K AMOLED四曲面柔性屏 陶瓷工艺 12GB+256GB
				白色
				游戏手机
				</span>
				<p class="price">￥5999.00</p>
				</div>
				</a>
				</div>
				<div class="xgs-col4">
				<a href="detail">
				<div>
				<img src="~/img/phone-market/xiaomi10s.jpg" alt="">
				<span class="goods-title">
				小米10S 5G新品手机【现货速发】 全网通 8G+128G 蓝色
				官方标配【原装33W充电套装+晒单20红包】
				</span>
				<p class="price">￥2699.00</p>
				</div>
				</a>
				</div>*@
			</div>
		</div>
		<!-- /文学 -->
	</div>
</div>